package cn.edu.pku.ss.lbs.content;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ZoneDatabase {
    private List<Zone> zoneList = new ArrayList<Zone>();

    public ZoneDatabase() {
        zoneList.add(new Zone("a", 0, 396, 0, 105));
        zoneList.add(new Zone("b", 0, 396, 105, 450));
        zoneList.add(new Zone("c", 396, 710, 105, 450));
        zoneList.add(new Zone("d", 710, 1000, 105, 450));
        zoneList.add(new Zone("e", 0, 396, 500, 900));
        zoneList.add(new Zone("f", 396, 700, 500, 900));
        zoneList.add(new Zone("g", 700, 1000, 500, 900));
    }

    public Zone getZone(int x, int y) {
        for (Zone zone : zoneList) {
            if (zone.contain(x, y)) return zone;
        }
        return null;
    }

    public List<Zone> getAllZones() {
        return Collections.unmodifiableList(zoneList);
    }
}
